package com.ruoyi.web.controller.system.app;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.AppUserAbout;
import com.ruoyi.system.service.IAppUserAboutService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 用户删除推荐记录Controller
 * 
 * @author ruoyi
 * @date 2021-08-18
 */
@Controller
@RequestMapping("/system/userAbout")
public class AppUserAboutController extends BaseController
{
    private String prefix = "system/about";

    @Autowired
    private IAppUserAboutService appUserAboutService;

    /**
     * 查询用户删除推荐记录列表
     */
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(AppUserAbout appUserAbout)
    {
        startPage();
        List<AppUserAbout> list = appUserAboutService.selectAppUserAboutList(appUserAbout);
        return getDataTable(list);
    }

    /**
     * 导出用户删除推荐记录列表
     */
    @Log(title = "用户删除推荐记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(AppUserAbout appUserAbout)
    {
        List<AppUserAbout> list = appUserAboutService.selectAppUserAboutList(appUserAbout);
        ExcelUtil<AppUserAbout> util = new ExcelUtil<AppUserAbout>(AppUserAbout.class);
        return util.exportExcel(list, "用户删除推荐记录数据");
    }

    /**
     * 新增保存用户删除推荐记录
     */
    @Log(title = "用户删除推荐记录", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(AppUserAbout appUserAbout)
    {
        return toAjax(appUserAboutService.insertAppUserAbout(appUserAbout));
    }

    /**
     * 修改用户删除推荐记录
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        AppUserAbout appUserAbout = appUserAboutService.selectAppUserAboutById(id);
        mmap.put("appUserAbout", appUserAbout);
        return prefix + "/edit";
    }

    /**
     * 修改保存用户删除推荐记录
     */
    @Log(title = "用户删除推荐记录", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(AppUserAbout appUserAbout)
    {
        return toAjax(appUserAboutService.updateAppUserAbout(appUserAbout));
    }

    /**
     * 删除用户删除推荐记录
     */
    @Log(title = "用户删除推荐记录", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(appUserAboutService.deleteAppUserAboutByIds(ids));
    }
}
